package com.xoa.controller.workflow;

import com.xoa.util.ToJson;
import com.xoa.util.http.HttpClientUtil;
import net.sf.json.JSONObject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.text.SimpleDateFormat;
import java.util.*;

@Controller
@RequestMapping("/flowTriggerProject")
public class FlowTriggerProjectController {


    //返回前台当前登录人cp端不能获取需要后台返回
    @RequestMapping("/budget")
    @ResponseBody
    public String budget(HttpServletRequest request){
        JSONObject jsonObject=null;
        try {
            String url = "http://47.93.18.92:8080/ZDynSerN/SvrThree";
            Map data = new HashMap();
            data.put("skey","ReturnBgtAmount");
            data.put("dbPool","demo");

            Map all = new HashMap();
            Map<String,String> d = new HashMap<>();
            SimpleDateFormat yMd = new SimpleDateFormat("yyyy/MM/dd");
            String date = yMd.format(new Date());
            d.put("TImeDim",date);
            d.put("DEPT_Code","6at6n7bg");
            d.put("ACC_Code","fd1f988306e24f23920525de1413fdef");
            all.put("dim",d);
            all.put("callFlag","1");
            data.put("para",all);
            jsonObject = JSONObject.fromObject(HttpClientUtil.doPost(url, data, "UTF-8"));
        }catch (Exception e){
            return e.getMessage();
        }
        return jsonObject.toString();
    }

}
